Sy step2#3
Open
izayaki22 wants to merge 5 commits intoPoolC:masterfrom
Open
Conversation
- 사용자가 입력하기 때문에 Input class에 getBonusNumber 메서드 추가
- 당첨번호가 5개인 로또들을 찾아 보너스 볼이 포함되어 있는지 확인한 후, 2등 당첨 개수를 반환 - bonusMatch가 MATCH, NOTMATCH인지에 따라 실행되는 run 함수가 다름
- 사용자가 입력하는 보너스 볼을 입력 받아 반환하는 메서드
- printWinStatistics 메서드의 인수에 count2ndLotto를 추가해 2등에 당첨된 개수도 출력
- printWinStatistics 메서드의 인수에 count2ndLotto를 추가해 2등에 당첨된 개수도 출력
VSFe
reviewed
Mar 16, 2023
Member
VSFe
left a comment
There was a problem hiding this comment.
수고하셨습니다!
이제 설계적인 고민을 훨씬 많이 하시며 코드를 작성한 느낌이 들어요!
다만, 역할이 다르다면 과감하게 파일을 분리할 필요가 있어요.
최대한 잘게 쪼개는 연습을 해보세요~
| return Double.parseDouble(df.format(((totalMoney - buyAmount) / buyAmount * 100))); | ||
| } | ||
|
|
||
| enum BonusMatch { |
Member
There was a problem hiding this comment.
파일이 너무 길어지니, Enum은 분리하는게 좋을 것 같아요.
| }, | ||
| MATCH(true){ | ||
| @Override | ||
| int run(ArrayList<Integer> lottoResults) { |
Member
There was a problem hiding this comment.
Enum 안에 기능을 넣는 것 보단, Enum을 받아서 처리하는 외부 메서드를 만들어서 관리하는게 더 좋을 것 같아요.
Enum은 쉽게 꺼내쓸 수 있는 이름표 정도로 생각하는게 의미론적 관점에서 더 좋습니다.
| @@ -65,8 +83,8 @@ public static ArrayList<Integer> countResults(ArrayList<Integer> winList, ArrayL | |||
|
|
|||
| public static int countMatchedNumbers(ArrayList<Integer> winList, ArrayList<Integer> lotto) { | |||
| return winArrayList; | ||
| } | ||
|
|
||
| public static int find2ndLotto(ArrayList<ArrayList<Integer>> lotto, ArrayList<Integer> countedList, ArrayList<Integer> lottoResults, int bonusNumber) { |
Member
There was a problem hiding this comment.
2등 로또 당첨은, 그냥
(전체 로또를 순회하면서)
(숫자가 겹치는지 확인)
(만약에 보너스 숫자가 일치하면 flag를 true로 변경)
(겹치는 숫자의 수와 flag 확인)
이 더 자연스러울 것 같아요!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.